
package com.jf.cloud.api.product.feign;

import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.product.bo.EsProductBO;
import com.jf.cloud.common.product.vo.SpuVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author zz
 * @date 2020/11/12
 */
@FeignClient(value = "jfcloud-product", contextId = "product")
public interface ProductFeignClient {

    /**
     * 通过spuId需要搜索的商品
     *
     * @param spuId spuid
     * @return es保存的商品信息
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/loadEsProductBO")
    ServerResponseEntity<EsProductBO> loadEsProductBO(@RequestParam("spuId") Long spuId);

    /**
     * 根据平台categoryId，获取spuId列表
     *
     * @param shopCategoryIds
     * @return spuId列表
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/getSpuIdsByShopCategoryIds")
    ServerResponseEntity<List<Long>> getSpuIdsByShopCategoryIds(@RequestParam("shopCategoryIds") List<Long> shopCategoryIds);

    /**
     * 根据categoryId列表，获取spuId列表
     *
     * @param categoryIds
     * @return spuId列表
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/getSpuIdsByCategoryIds")
    ServerResponseEntity<List<Long>> getSpuIdsByCategoryIds(@RequestParam("categoryIds") List<Long> categoryIds);

    /**
     * 根据brandId，获取spuId列表
     *
     * @param brandId
     * @return spuId列表
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/getSpuIdsByBrandId")
    ServerResponseEntity<List<Long>> getSpuIdsByBrandId(@RequestParam("brandId") Long brandId);

    /**
     * 根据供应商店铺id，获取spuId列表(仅处于上架状态的商品)
     *
     * @param supplierId
     * @return spuId列表
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/listSpuIdsBySupplierIdAndSupplierSpuType")
    ServerResponseEntity<List<SpuVO>> listSpuIdsBySupplierIdAndSupplierSpuType(@RequestParam("supplierId") Long supplierId, @RequestParam(value = "createTime", required = false) String createTime, @RequestParam("supplierSpuType")Integer supplierSpuType);

    /**
     * 根据供应商id批量获取商家代销商品信息(所有商品,不包括删除商品)
     * @param supplierId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/listMerchantSpuIdsBySupplierId")
    ServerResponseEntity<List<SpuVO>> listMerchantSpuIdsBySupplierId(@RequestParam("supplierId") Long supplierId);

    /**
     * 根据商品id列表获取商品列表
     * @param spuIds
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/listSpuBySpuIds")
    ServerResponseEntity<List<SpuVO>> listSpuBySpuIds(@RequestBody List<Long> spuIds);
    /**
     * 获取spu分组列表
     *
     * @param spuId
     * @return spu分组列表
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/getSpuTagBySpuId")
    ServerResponseEntity<List<Long>> getSpuTagBySpuId(@RequestParam("shopId") Long spuId);

    /**
     * 商品状态发生改变时，需要处理的事件
     *
     * @param spuId 商品id
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/handleStatusChange")
    ServerResponseEntity<Void> handleStatusChange(@RequestParam("spuId") Long spuId);

//    /**
//     * 根据参数获取spu列表
//     * @param param 参数
//     * @param spuIds 商品id列表
//     * @return spu列表
//     */
//    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/getSpuListByParam")
//    ServerResponseEntity<List<ProdEffectRespVO>> getSpuListByParam(@RequestBody ProdEffectDTO param,
//                                                                   @RequestParam(value = "spuIds",required = false) Set<Long> spuIds);
//
//    /**
//     * 根据参数获取spu列表总条目
//     * @param param 参数
//     * @param spuIds 商品id列表
//     * @return spu列表总条目
//     */
//    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/getSpuListTotalByParam")
//    ServerResponseEntity<Long> getSpuListTotal(@RequestBody ProdEffectDTO param,
//                                               @RequestParam(value = "spuIds",required = false) Set<Long> spuIds);

}
